package com.value.lister;

import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.value.model.AnnotationXmlBean;
import com.value.util.AnnotationConfig;

public class ActionLister implements ServletContextListener{

	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		ServletContext context = sce.getServletContext();
		String path = context.getInitParameter("strutsConfig");
		String filePath = context.getRealPath("\\")+path;
		Map<String,AnnotationXmlBean> map =AnnotationConfig.xmlResolve(filePath);
		try {
			context.setAttribute("annotationMap", map);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("加载struts配置文件出错....");
		}
		System.out.println("系统已经加载成功......");
	}

}
